﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DeviceManage.aspx.cs" Inherits="DeviceManage" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../../Content/css/ui-lightness/jquery-ui-1.8.16.custom.css" rel="stylesheet"
        type="text/css" />
    <script src="../../Content/js/jquery-1.6.2.min.js" type="text/javascript"></script>
    <script src="../../Content/js/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>
    <link href="../../Content/Style.css" rel="stylesheet" type="text/css" />
    <script>
        function addDevice() {
            var horizontalPadding = 30;
            var verticalPadding = 30;
            $("<iframe id='externalSite' src='DeviceAdd.aspx' scrolling='no' />").dialog({
                title: "添加设备",
                autoOpen: true,
                width: 350,
                height: 150,
                modal: true,
                resizable: true,
                autoResize: true,
                beforeclose: function () { window.location.reload(); },
                overlay: {
                    opacity: 0.5,
                    background: "black"
                }
            }).width(350 - horizontalPadding).height(150 - verticalPadding);
        }

        function editDevice(id) {
            var horizontalPadding = 30;
            var verticalPadding = 30;
            $("<iframe id='externalSite' src='DeviceAdd.aspx?id=" + id + "' scrolling='no' />").dialog({
                title: "修改设备",
                autoOpen: true,
                width: 350,
                height: 150,
                modal: true,
                resizable: true,
                autoResize: true,
                beforeclose: function () { window.location.reload(); },
                overlay: {
                    opacity: 0.5,
                    background: "black"
                }
            }).width(350 - horizontalPadding).height(150 - verticalPadding);
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
                <td height="30">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td width="15" height="30">
                                <img src="/Content/images/tab/tab_03.gif" width="15" height="30" />
                            </td>
                            <td width="1101" background="/Content/images/tab/tab_05.gif">
                                <img src="/Content/images/tab/311.gif" width="16" height="16" />
                                <span class="STYLE4">设备信息管理</span>
                            </td>
                            <td width="281" background="/Content/images/tab/tab_05.gif">
                                <input type="button" onclick="addDevice()" value="添加设备" id="btn_add" />
                            </td>
                            <td width="14">
                                <img src="/Content/images/tab/tab_07.gif" width="14" height="30" />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td>
                    <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td width="9" background="/Content/images/tab/tab_12.gif">
                                &nbsp;
                            </td>
                            <td>
                                <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td style="text-align: center">
                                            <asp:GridView ID="Grid_Device" runat="server" AutoGenerateColumns="False" CellPadding="4"
                                                EnableModelValidation="True" ForeColor="#333333" GridLines="None" 
                                                Width="100%" AllowPaging="True" 
                                                onselectedindexchanging="Grid_Device_SelectedIndexChanging">
                                                <AlternatingRowStyle BackColor="White" />
                                                <RowStyle HorizontalAlign="Center" />
                                                <Columns>
                                                    <asp:BoundField />
                                                    <asp:BoundField DataField="id" HeaderStyle-Width="40px" FooterText="编号" HeaderText="编号" />
                                                    <asp:BoundField DataField="MacAddress" FooterText="Mac地址" HeaderText="Mac地址" />
                                                    <asp:TemplateField HeaderText="门店名称">
                                                        <ItemTemplate>
                                                            <%#GetStoresName((int)Eval("Stores_ID"))%>
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:TemplateField HeaderText="设备状态">
                                                        <ItemTemplate>
                                                            <image src="../../Content/images/state_<%#Eval("LineStatus")%>.gif"></image>
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:TemplateField  HeaderText="操作">
                                                        <ItemTemplate>
                                                            <a href="javascript:void(0)" onclick="editDevice(<%#Eval("id")%>)">修改设备信息</a>
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                </Columns>
                                                <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                                                <HeaderStyle BackColor="#cae1ac" Font-Bold="True" ForeColor="White" />
                                                <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
                                                <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                                                <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                                            </asp:GridView>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                            <td width="9" background="/Content/images/tab/tab_16.gif">
                                &nbsp;
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td height="29">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td width="15" height="29">
                                <img src="/Content/images/tab/tab_20.gif" width="15" height="29" />
                            </td>
                            <td background="/Content/images/tab/tab_21.gif">
                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td width="25%" height="29" nowrap="nowrap">
                                        </td>
                                        <td width="75%" valign="top" class="STYLE1">
                                        </td>
                                    </tr>
                                </table>
                            </td>
                            <td width="14">
                                <img src="/Content/images/tab/tab_22.gif" width="14" height="29" />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
